<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>each demo</title>
    <style>
        ul { font-size:18px; margin:0; }
        span { color:blue; text-decoration:underline; cursor:pointer; }
        .example { font-style:italic; }
    </style>
    <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
</head>
<body>
To do list: <span>(click here to change)</span>
<ul>
    <li>Eat</li>
    <li>Sleep</li>

    <li>Be merry</li>
</ul>
<script>
    $( "span" ).click(function () {
        $( "li" ).each(function(){
            $( this ).toggleClass( "example" );
            alert(this.tagName)
        });
    });

</script>

</body>
</html>